//
//  OtherViewController.m
//  GameBoss
//
//  Created by dllo on 15/4/22.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "OtherViewController.h"
#import "TacticViewController.h"
#import "MoreViewController.h"
#import "GamePrefectureViewController.h"
#import "ElectronicViewController.h"
@interface OtherViewController ()
@property (nonatomic, retain) NSMutableArray *moreArr;
@property (nonatomic, retain) UITableView *tableView;

@end

@implementation OtherViewController
- (void)dealloc
{
    [_tableView release];
    [_moreArr release];
    [super dealloc];
}
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.moreArr = [NSMutableArray arrayWithObjects:@"单机",@"动漫", @"掌机", @"硬件", @"产业",@"手游", @"页游",@"攻略",@"游戏专区", @"电竞", nil];
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, Screen.width, Screen.height)];
    imageView.image = [UIImage imageNamed:@"daoheng"];
    [self.view addSubview:imageView];
    [imageView release];
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, Screen.width, Screen.height -  64) style:(UITableViewStylePlain)];
    [self.view addSubview:self.tableView];
    self.tableView.backgroundColor = [UIColor clearColor];
    self.tableView.dataSource = self;
    self.tableView.delegate = self;
    [_tableView release];
    
#pragma mark 夜间判断
//    if ([NightMode shareNightMode].isNight) {
//        [[NightMode shareNightMode] loadNightModeInfoFormDisk];
//    }
}
- (NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *reuse = @"reuse";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuse];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:(UITableViewCellStyleValue1) reuseIdentifier:reuse];
    }
    cell.textLabel.text = self.moreArr[indexPath.row];
    cell.textLabel.textColor = [UIColor whiteColor];
    cell.backgroundColor = [UIColor clearColor];
    return cell;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 60 * Screen.height / 667;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 7)
    {
        TacticViewController *tacticVC = [[TacticViewController alloc] init];
        [self.navigationController pushViewController:tacticVC animated:YES];
        [tacticVC release];
    }else if (indexPath.row == 8)
    {
        GamePrefectureViewController *GPVC = [[GamePrefectureViewController alloc] init];
        [self.navigationController pushViewController:GPVC animated:YES];
        [GPVC release];
    }else if (indexPath.row == 9)
    {
        ElectronicViewController *eleVC = [[ElectronicViewController alloc] init];
        [self.navigationController pushViewController:eleVC animated:YES];
        [eleVC release];
    }
    else
    {
        MoreViewController *moreVC = [[MoreViewController alloc] init];
        moreVC.title = self.moreArr[indexPath.row];
        NSString *str = [NSString stringWithFormat:@"%ld",indexPath.row + 8];
        moreVC.num = str;
        [self.navigationController pushViewController:moreVC animated:YES];
        [moreVC release];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark 选取白黑两种模式
- (void)setNightDayModel {
    [NightManager setViewColorWithView:self.tableView];
    //    [NightManager setLabelColorWithLabel:self.title];
    
}

- (void)setLightDayModel {
    [NightManager setViewColorWithView:self.tableView];
    //    [NightManager setLabelColorWithLabel:self.title];
    
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
